<template>
    <div class="body_background" :style="GetWindowBackground">
        <div class="body_background padding-top10">
            <div class="block-box items-start">
                <div class="big-font-size three-color">员工信息</div>
                <ul class="create-box">
                    <li>
                        <div class="big-font-size main-color">员工姓名：</div>
                        <input type="text" class=""/>
                    </li>
                    <li>
                        <div class="big-font-size main-color">登录手机：</div>
                        <input type="text" class=""/>
                    </li>
                </ul>
            </div>
            <div class="block-box items-start">
                <div class="big-font-size three-color">岗位信息</div>
                <ul class="create-box">
                    <li>
                        <div class="big-font-size main-color">所属部门：</div>
                        <select v-model="couponSelected" @change="getSelected">
                            <option :value="coupon.id" v-for="coupon in couponList" >{{coupon.name}}</option>
                        </select>
                    </li>
                    <li>
                        <div class="big-font-size main-color">所属岗位：</div>
                        <select v-model="couponSelected" @change="getSelected">
                            <option :value="coupon.id" v-for="coupon in couponList" >{{coupon.name}}</option>
                        </select>
                    </li>
                </ul>
            </div>

            <div class="button-box">
                <mt-button class="width40 middle-font-size"
                           @click="cancelStaffFun"
                >取消</mt-button>
                <mt-button class="width40 middle-font-size background white-color"
                           @click="createStaffFun"
                >提交</mt-button>
            </div>
        </div>
    </div>
</template>

<script>

    export default {
        name: "StaffCreate",
        data() {
            return {
                id: '',
                GetWindowBackground: {
                    'min-height': ''
                },
                couponList:[
                    {
                        id: '1',
                        name: '技术部'
                    },
                    {
                        id: '2',
                        name: '财务部'
                    }
                ],
                couponSelected: '',
            }
        },
        created(){
            //如果没有这句代码，select中初始化会是空白的，默认选中就无法实现
            this.couponSelected = this.couponList[0].id;
        },
        mounted() {
            this.id = this.$route.query.id;
            console.log(this.id)
        },
        methods: {
            //获取选中
            getSelected(){
                console.log(this.couponSelected)
            },
            //查看更多订单
            lookMoreOrder(item) {
                this.goodsShow = !this.goodsShow
            },
            //取消
            cancelStaffFun(item) {
                this.$router.push('/StaffManage')
            },
            //编辑
            createStaffFun(item) {
                this.$router.push('/StaffManage')
            },
            getBodyHeight() {
                // 获取浏览器高度，减去顶部搜索栏和导航栏的值 55 + 50（可动态获取）,再减去底部高度值60
                this.GetWindowBackground['min-height'] = window.innerHeight + 'px'
            },
        },
        // 生命周期 - 创建完成（可以访问当前this实例）
        created() {
            window.addEventListener('resize', this.getBodyHeight) // 注册监听器
            this.getBodyHeight() // 页面创建时先调用一次
        },
        // 生命周期 - 销毁完成
        destroyed() {
            window.removeEventListener('resize', this.getBodyHeight)
        },
    }
</script>

<style lang="scss" scoped>


    .padding-top10 {
        padding-top: 15px;
    }

    .block-box {
        width: calc(100% - 80px);
        padding: 20px 30px;
        border-radius: 8px;
        margin-bottom: 15px;
    }


    .title-box{
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .create-box{
        width: 100%;
        padding-bottom: 20px;
        margin-top: 5px;
        li{
            width: 100%;
            height: 45px;
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            div{
                margin-bottom: 7px;
            }
            input,select{
                width: calc(100% - 100px);
                height: 30px;
                border-top:0;
                border-left:0;
                border-right:0;
                border-bottom: 1px solid #ebedf1;
                outline: none;
                list-style: none;
            }
        }
    }

    .button-box {
        width: 100%;
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 45px;
        .width40 {
            width: 40%;
            border: 1px solid #05c569;
            color: #05c569;
            border-radius: 10px;
        }
    }


</style>